﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="format-detection" content="telephone=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <link href="~/Areas/Admin/Content/css/bksystem.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/skin/black/skin.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/css/module.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/font/iconfont.css" rel="stylesheet" />    
    <script src="~/Areas/Admin/Content/js/jquery-1.9.1.min.js"></script>
    <script src="~/Areas/Admin/Content/js/jquery.cookie.js"></script>
    <script src="~/Areas/Admin/Content/js/jquery.nicescroll.js"></script>
    <script src="~/Areas/Admin/Content/js/BKframe.js"></script>
    <!--[if lt IE 9]>
         <script src="~/Areas/Admin/Content/js/html5shiv.js"></script>
         <script src="~/Areas/Admin/Content/js/css3-mediaqueries.js"></script>
    <![endif]-->
    <title>登录</title>
</head>
<body class="login-layout Reg_log_style" id="loginstyle">
    <div class="logintop">
        <span>后台管理界面平台</span>
        <ul>
            <li>
                <a href="#">返回首页</a>
            </li>
            <li>
                <a href="#">帮助</a>
            </li>
            <li>
                <a href="#">关于</a>
            </li>
        </ul>
    </div>
    <div class="loginbody">
        <div class="login-container">
            <div class="center"> <img src="~/Areas/Admin/Content/images/logo.png" /></div>
            <div class="space-6"></div>
            <div class="position-relative">
                <div id="login-box" class="login-box widget-box no-border visible">
                    <div class="login-main">

                        <div class="clearfix">
                            <div class="login_icon"><img src="~/Areas/Admin/Content/images/login_img.png" /></div>

                            <form action="" name="AdminLogin" style="width:300px; float:right; margin-right:50px;">
                                <h4 class="title_name"><img src="~/Areas/Admin/Content/images/login_title.png" /></h4>
                                <fieldset>
                                    <ul>
                                        @{
                                            var pwd = Session["AdminPwd"] != null ? Session["AdminPwd"] : "";
                                         }
                                    <li class="frame_style form_error"><label class="user_icon iconfont">&#xe620;</label><input name="loginName" type="text" data-name="用户名" id="username" required="required" /><i>用户名</i></li>
                                    <li class="frame_style form_error"><label class="password_icon iconfont">&#xe625;</label><input name="loginPwd" type="password" data-name="密码" value="@pwd" id="userpwd" required="required" /><i>密码</i></li>
                                    <li class="frame_style form_error">
                                        <label class="Codes_icon iconfont">&#xe624;</label><input name="IsOk" type="text" data-name="验证码" id="Codes_text" required="required" /><i>验证码</i>
                                        <div class="Codes_region">
                                            <img src="@Url.Action("CreateCode", "Admin")" id="createimg" title="看不清，换一张" width="100%" height="38px" />
                                        </div>
                                    </li>
                                </ul>
                                <div class="space"></div>
                                <div class="clearfix">
                                    <label class="inline">
                                        <input type="checkbox" class="ace" id="savePwd">
                                        <span class="lbl">保存密码</span>
                                    </label>
                                    <button type="submit" class="login_btn" id="login_btn" style="margin-right:115px;"> 登&nbsp;陆 </button>
                                </div>
                                <div class="space-4"></div>
                            </fieldset>
                        </form>

                    </div>
                    <div class="social-or-login center">
                        <span class="bigger-110">通知</span>
                    </div>
                    <div class="social-login ">
                        本网站系统不对IE8（含IE8）以下浏览器支持，请见谅。
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="loginbm">版权所有 项目开发小组@2018年</div>
</body>
</html>

<script src="~/Scripts/jquery-1.8.2.js"></script>
<script src="~/Content/layer/layer.js"></script>
<script type="text/javascript">
    //表单提交事件
    $("[name=AdminLogin]").submit(function () {
        var loginName = $("[name=loginName]").val();
        var loginPwd = $("[name=loginPwd]").val();
        var IsOk = $("[name=IsOk]").val();
        var savePwd = $("#savePwd").is(':checked');
        $.post("@Url.Action("DoAdminLogin", "Admin")",
            { loginName: loginName, loginPwd: loginPwd, IsOk: IsOk, savePwd: savePwd },
            function (data) {
                switch (data) {
                    case "ISNO":
                        layer.msg('验证码错误！', { icon: 5 });
                        CreateByCodeImg();
                        break;
                    case "NO":
                        layer.msg('请确认账户密码！', { icon: 5 });
                        CreateByCodeImg();
                        break;
                    case "TYPENO":
                        layer.msg('账户权限不足！', { icon: 5 });
                        CreateByCodeImg();
                        break;
                    case "OK":
                        //加载层-风格2
                        layer.load(1);
                        setTimeout(function () {
                            layer.msg('登录成功！', { icon: 6 });
                            location.href = '@Url.Action("SAdminIndex", "Admin")';
                        }, 3000);
                        break;i
                    default:
                }
            });
        return false;
    });


    //验证码、获取以保存密码
    function CreateByCodeImg() {
        var url = "@Url.Action("CreateCode", "Admin")?rums=" + Math.random();
        $("#createimg").attr("src", url);
    }
    $(function () {
        $("#createimg").click(function () {
            CreateByCodeImg();
        })
    });

    //验证登录
    $(document).ready(function () {
        $("input[type='text'],input[type='password']").blur(function () {
            var $el = $(this);
            var inputname = 0;
            var $parent = $el.parent();
            $parent.attr('class', 'frame_style').removeClass(' form_error');
            if ($el.val() == '') {
                var name = $el.attr("data-name");
                $parent.attr('class', 'frame_style').addClass(' form_error form_prompt');
                $parent.find('i').eq(inputname).html(name + "不能为空").addClass("prompt");
            }
        });
        $("input[type='text'],input[type='password']").focus(function () {
            var $el = $(this);
            var $parent = $el.parent();
            if ($el.val() == '') {
                $parent.attr('class', 'frame_style').addClass(' form_errors');
            } else {
                $parent.attr('class', 'frame_style').removeClass(' form_errors');
            }
        });
        $('#login_btn').on('click', function () {
            var num = 0;
            var str = "";
            $("input[type$='text'],input[type$='password']").each(function (n) {
                var $el = $(this);
                var inputname = 0;
                var $parent = $el.parent();
                if ($el.val() == "") {
                    var name = $el.attr("data-name");
                    $parent.attr('class', 'frame_style').addClass(' form_error form_prompt');
                    $parent.find('i').eq(inputname).html(name + "不能为空").addClass("prompt");
                    num++;
                    return false;
                }
            });
        });
    });

</script>
